﻿using B.S.Database.ErrorCode;
using B.S.Database.Write.Api.Application.Commands.Breeding;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Database.Write.Api.Controllers
{
    /// <summary>
    /// 养殖控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BreedingController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;
        /// <summary>
        /// 日志
        /// </summary>
        private readonly ILogger<BreedingController> logger;

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="logger"></param>
        public BreedingController(IMediator mediator, ILogger<BreedingController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }
        /// <summary>
        /// 设置
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Apiresult<object>> BreedingCreate(BreedingCreateCommands request)
        {
            logger.LogInformation("养殖信息设置");
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Apiresult<object>> CompanyCreate(CompanyCreateCommands request)
        {
            logger.LogInformation("企业信息设置");
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Apiresult<object>> ImmuneCreate(ImmuneCreateCommands request)
        {
            logger.LogInformation("保健信息设置");
            return mediator.Send(request); 
        }
        /// <summary>
        /// 删除保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Apiresult<object>> ImmuneUpdate(ImmuneUpdateCommands request)
        {
            logger.LogInformation("删除保健信息");
            return mediator.Send(request);
        }
        /// <summary>
        /// 修改保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Apiresult<object>> ImmuneXiugai(ImmuneXiugaiCommands request)
        {
            logger.LogInformation("修改保健信息");
            return mediator.Send(request);
        }
    }
}
